import http from './requestConfig'
/**
 * API baseUrl
 * @param env
 * @returns {*}
 */
// export function setBaseURL(env = 'development'): string {
//   process.env.NODE_ENV === 'production' ? (env = 'production') : (env = 'development')

//   // #ifdef H5
//   if (['localhost'].includes(window.location.hostname)) {
//     env = 'development'
//   }
//   if (['test-m.bendiclass.com'].includes(window.location.hostname)) {
//     env = 'development'
//   }

//   if (['m.bendiclass.com'].includes(window.location.hostname)) {
//     env = 'production'
//   }
//   // #endif
//   const URL_LIST = {
//     development: 'https://test-api.bendiclass.com',
//     production: 'https://api.bendiclass.com'
//   }

//   return URL_LIST[env]
// }

const config = {
  isMock: 1,
  tokenKey: 'KOUSUAN_TOKEN',
  // requestUrl: setBaseURL() 
  requestUrl: 'https://api.bendiclass.com'
}

// http请求配置项
http.setConfig({
  baseUrl: config.requestUrl,
  fileUrl: config.requestUrl,
  defaultUploadUrl: config.requestUrl,
  header: {
    'content-type': 'application/json;charset=UTF-8'
  },
  timeout: 15000,
  config: {
    isPrompt: true,
    load: false,
    isFactory: true
  }
})

export { config, http }
